<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="com.bobamrz.model.Camera" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
	<a href='s'>servlet</a> | <a href='http://imbi.ld.ttu.ee/tomcat_webapp_logs/camera/log.txt'>log.txt</a><br>
	<%out.print(request.getAttribute("documentData"));%>
	<%
		String[] fields = (String[])request.getAttribute("fields"); 
		String[] formErrors = (String[])request.getAttribute("formErrors");
		boolean hasErrors = (Boolean)request.getAttribute("hasErrors");
	%>
	<form name="input" action="s?action=save" method="post">
		<% if (hasErrors) {
			out.print("<h2>Save unsuccessful.</h2>");
		}%>
		ID:<br />
		<input type="text" name="id" size="30" readonly
		value ="<%out.print(fields[0]);%>"><br />
		Model: <br /><input type="text" name="model" size="30" 
		value = "<%out.print(fields[1]);%>"><br />
		<% if (formErrors[1] != null) {
			out.print("<p>"+formErrors[1]+"</p><br />");
		}%>
		Description: <br />
		<textarea name="description" cols="25" rows="5"><%
		if (fields[3] != null) {
			out.print(fields[3]);
		}%></textarea><br />
		<% if (formErrors[3] != null) {
			out.print("<p>"+formErrors[3]+"</p><br />");
		}%>
		Sensor resolution (Mpx): <br /><input type="text" name="resolution" size="30" 
		value = "<%out.print(fields[2]);%>"><br />
		<% if (formErrors[2] != null) {
			out.print("<p>"+formErrors[2]+"</p><br />");
		}%>
		<input type="submit" value="Submit">
	</form> 
</body>
</html>